package com.acme;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;

public class TestAppActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
		WindowManager winMan = (WindowManager) this.getApplicationContext().getSystemService(Context.WINDOW_SERVICE);

        Button awards =  (Button)findViewById(R.id.awardsBtn);
        Button players = (Button)findViewById(R.id.playersBtn);        
        if (winMan != null){
            int orientation = winMan.getDefaultDisplay().getOrientation();
        	if(orientation == 0){
        		setContentView(R.layout.main);
        	}
        	else if(orientation == 1){
            	setContentView(R.layout.main_landscape);
	            
            }
            	
        }
        
        if(awards == null)
        	awards =  (Button)findViewById(R.id.awardsBtn);
       if(players == null)
    	   players = (Button)findViewById(R.id.playersBtn);
       
        awards.setOnClickListener(new OnClickListener() {
        	public void onClick(View view){
        		Intent newIntent = new Intent(TestAppActivity.this, AwardLevels.class);
        		TestAppActivity.this.startActivity(newIntent);
        	}
        });
       
	players.setOnClickListener(new OnClickListener() {
 	  public void onClick(View view){
 		  Intent newIntent = new Intent(TestAppActivity.this, PlayerSearch.class);
 		  TestAppActivity.this.startActivity(newIntent);
 	  }
    });
    }
}